<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>佣金提现</title>

<meta name="viewport" id="mobileViewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Pragma" content="no-cache">
<meta name="description" content="！">
<meta name="Keywords" content="">

<link rel="stylesheet" href="${contextPath}/staticwx/hx/css/reset.css">
<link rel="stylesheet" href="${contextPath}/staticwx/hx/css/global.css">
<link rel="stylesheet" href="${contextPath}/staticwx/hx/css/iconfont.css">
<link rel="stylesheet" href="${contextPath}/staticwx/hx/css/flex.css">
<link rel="stylesheet" href="${contextPath}/staticwx/hx/css/uc.css">
<link rel="stylesheet" href="//cdn.bootcss.com/weui/1.1.1/style/weui.min.css">
<link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/1.0.1/css/jquery-weui.min.css">

</head>
<body>
	<div class="wrapper">
	    <header class="header">
	        <div class="hl"><a href="javascript:history.back();"><span class="iconfont icon-fanhui"></span></a></div>
	        <div class="hc">佣金提现</div>
	        <div class="hr"><span class="iconfont icon-zhuye"></span></div>
	    </header>
	    <div class="space"></div>
	    <ul class="txList1">
			<li>
				<span>我的佣金</span>
				<span class="f16 cred"><e id="rebate">${account.rebate!0}</e>元&nbsp;</span>
                <small><em>(提现需扣除${prop}%手续费)</em></small>
			</li>
	    </ul>
		<div class="space"></div>
		<div class="txje" flex="cross:center">
			<label for="amount">提现金额</label>
			<select id="amount" style="width: 80%;">
                <option>100</option>
                <option>200</option>
                <option>300</option>
                <option>500</option>
                <option>1000</option>
            </select>
		</div>
		<div class="space"></div>
		<div class="titPub">
	        <a href="${contextPath}/wx/bankcard/add.htm?from=1" class="clearfix">
	            <p class="fl">提现账号</p>
	            <span class="fr"><span class="cblue f12">+添加银行卡</span></span>
	        </a>
	    </div>
	    <ul class="txList2">
            <li flex="cross:center">
                <img src="${contextPath}/staticwx/hx/images/zfb.png" >
                <div class="con">
                    <p class="p1">支付宝</p>
                </div>
                <div class="radioBtn radioBtnCss">
                    <span class="iconfont gou"></span>
                    <input type="radio" name="tixianf" class="">
                </div>
            </li>
            <#if bclist??>
                <#list bclist as l>
                    <li flex="cross:center">
                        <img src="${contextPath}/staticwx/hx/images/${l.bankname!}.png" alt="">
                        <div class="con" realname="${l.realname!}" bankplace="${l.bankplace!}">
                            <p class="p1">${l.bankname!}</p>
                            <p class="p2">${l.bankaccount!}</p>
                        </div>
                        <div class="radioBtn radioBtnCss">
                            <span class="iconfont gou"></span>
                            <input type="radio" name="tixianf" class="">
                        </div>
                    </li>
                </#list>
            </#if>
	    </ul>
	    <div class="btnPub2">
			<a href="javascript:;" class="btn" onclick="sub()">确认提现</a>
	    </div>
	</div>

<script src="${contextPath}/staticwx/hx/js/jquery-3.0.0.min.js" type="text/javascript"></script>
<script src="//cdn.bootcss.com/jquery-weui/1.0.1/js/jquery-weui.min.js"></script>
<script type="text/javascript">
	$(".txList2 .radioBtn").click(function(){
		$(".txList2 .radioBtn.selected").removeClass("selected");
		$(this).addClass("selected");
		$(".txList2 input[name='tixianf']:checked").prop("checked",false)
		$(this).find("input[name='tixianf']").prop("checked",true)
	});
	function sub(){
        var check = $(".txList2 input[name='tixianf']:checked");
        var mdiv = $(check).parent(".radioBtn").prev(".con");
        var rebate = ($("#rebate").text())*1;
        var amount = $("#amount").val()*1;
        if(!amount || amount=='' || (rebate - amount)<0){
            $.alert("请输入小于等于账户佣金余额的提现金额");
            return false;
        }
        var bankname = $(mdiv).find(".p1").text();
        if(!bankname){
            $.alert("请选择提现账号");
            return false;
        }
        if(bankname=='支付宝'){
            location.href="${contextPath}/wx/cash/rebateAlipay.htm?amount="+amount;
        }else{
            var realname = $(mdiv).attr("realname");
            var bankplace = $(mdiv).attr("bankplace");
            var bankaccount = $(mdiv).find(".p2").text();
            if(!bankaccount){
                $.alert("该银行卡号为空");
                return false;
            }
            $.ajax({
                url:"${contextPath}/wx/cash/cashApplyRebate.htm",
                data:{amount:amount,bankname:bankname,realname:realname,bankplace:bankplace,bankaccount:bankaccount,paytype:2},
                type:"post",
                success:function(data){
                    var json = $.parseJSON(data);
                    $.alert(json.errMessage,function(){
                        location.href="${contextPath}/wx/member/myRebate.htm";
                    });
                }
            });
        }
    }
</script>
</body>
</html>